/**
* Created with CLion.
* User:Lenovo
* Date:2023-05-31
* Time:1:12
* Description:测试
*/

#include "Heap.h"

void HeapTest()
{
    HP hp;
    HeapInit(&hp);
    int a[] = {65, 100, 70, 32, 50, 60};
    for (int i = 0; i < sizeof(a) / sizeof(a[0]); i++)
    {
        HeapPush(&hp, a[i]);
    }

    while (!HeapEmpty(&hp))
    {
        int top = HeapTop(&hp);
        printf("%d\n", top);
        HeapPop(&hp);
    }
    // 不叫排序，因为只是打印出来，没有排序
}

int main()
{
    int a[] = {7, 8, 3, 5, 1, 8, 9, 4};
    HeapSort(a, sizeof(a) / sizeof(a[0]));
    for (int i = 0; i < sizeof(a) / sizeof(a[0]); i++)
    {
        printf("%d ", a[i]);
    }

    return 0;
}
